home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / games / texturemapping / chunkytoplanar.asm < prev    next >
Assembly Source File  |  1980-01-03  |  14KB  |  540 lines

  1.     addsym
  2.     opt    p=68020
  3.  
  4.     include    'demo.i'
  5.     include    'graphics/gfx.i'
  6.  
  7.     xref    _LVOCacheClearU
  8.  
  9. ;
  10. ; For convenience and efficiency, this routine processes 8 pixels at
  11. ; a time.  In effect, it rotates the 64 bits (from the 8 consecutive
  12. ; 8-bit pixels) in the chunky pixel figure above counterclockwise 90
  13. ; degrees so that the data is organized as in the planar pixel figure
  14. ; above.
  15. ;
  16. ; This routine proceeds like this:
  17. ;
  18. ; (A) Initialize
  19. ; (B) Process 8 pixels at a time
  20. ;     (B1) Load registers with 8 pixels in chunky form
  21. ;     (B2) Rotate bits counterclockwise 90 degrees
  22. ;       (B2a) Rotate 4x4 groups within full 8x8
  23. ;       (B2b) Prepare to rotate 2x2 groups within each 4x4 group
  24. ;       (B2c) Rotate 2x2 groups within each 4x4 group |
  25. ;       (B2d) Prepare to rotate single bits within each 2x2 group
  26. ;       (B2e) Rotate single bits within each 2x2 group
  27. ;     (B3)  Store 8 pixels in planar form
  28. ; (C) Continue processing
  29. ; (D) Finish
  30.  
  31.  
  32. ; void __asm ChunkyToPlanar(register __a0 unsigned char *ChunkyPixels, register __a1 struct BitMap *destbm,
  33. ;               register __d0 destx, register __d1 int desty, register __d6 int width,    //__asm
  34. ;             register __d7 int high );                            //__asm
  35.  
  36.  
  37. ; +----------------------+
  38. ; | Step (A): Initialize |
  39. ; +----------------------+
  40.  
  41. _ChunkyToPlanar::
  42.  
  43.     MoveM.L D2-D7/A2-A6,-(A7)          ;Save appropriate registers
  44.  
  45. ; Register usage:
  46. ;
  47. ;    D0    64-bits of the 8 8-bit pixels
  48. ;    D1    Another 64-bits of the 8 8-bit pixels
  49. ;    D2    Masked copy of D0
  50. ;    D3    Masked copy of D1
  51. ;    D4    Mask
  52. ;    D5    Complement of D4
  53. ;    D6    Offset for plpx[]
  54. ;    D7    Count of remaining pixels
  55. ;    A0    Input chunky pixel scanning pointer
  56. ;    A1    Pointer to plpx[0]
  57. ;    A2    modulo
  58. ;    a3=iters/line
  59. ;    a4=$f0f0f0f0
  60. ;    a5=$cccccccc
  61. ;    a6=$ff00ff00
  62. ; +--------------------------------------+
  63. ; | Step (B): Process 8 pixels at a time |
  64. ; +--------------------------------------+
  65.  
  66.     lsr.l    #3,d0
  67.     mulu    bm_BytesPerRow(a1),d1
  68.     add.l    d0,d1    ; d1=byte offset
  69.  
  70.     subq    #1,d7    ; adjust height loop var
  71.  
  72. ; now, determine if we need to poke the plane offset values in the destination
  73. ; stor section
  74.  
  75.     move.l    bm_Planes(a1),d4
  76.     neg.l    d4
  77.     move.l    bm_Planes+4(a1),a2
  78.     lea    -1(a2,d4.l),a2    ; a2=pl[1]-pl[0]-1
  79.     cmp.w    modify_me_plane1+2,a2
  80.     beq.s    no_self_modify
  81.     move.w    a2,modify_me_plane1+2
  82.  
  83.     move.l    bm_Planes+8(a1),a2
  84.     lea    -1(a2,d4.l),a2
  85.     move.w    a2,modify_me_plane2+2
  86.  
  87.     move.l    bm_Planes+12(a1),a2
  88.     lea    -1(a2,d4.l),a2
  89.     move.w    a2,modify_me_plane3+2
  90.  
  91.     move.l    bm_Planes+16(a1),a2
  92.     lea    -1(a2,d4.l),a2
  93.     move.w    a2,modify_me_plane4+2
  94.  
  95.     move.l    bm_Planes+20(a1),a2
  96.     lea    -1(a2,d4.l),a2
  97.     move.w    a2,modify_me_plane5+2
  98.  
  99.     move.l    bm_Planes+24(a1),a2
  100.     lea    -1(a2,d4.l),a2
  101.     move.w    a2,modify_me_plane6+2
  102.  
  103.     move.l    bm_Planes+28(a1),a2
  104.     lea    -1(a2,d4.l),a2
  105.     move.w    a2,modify_me_plane7+2
  106.  
  107.     movem.l    a0/a1/d0/d1,-(a7)
  108.     move.l    $4,a6
  109.     jsr    _LVOCacheClearU(a6)
  110.     movem.l    (a7)+,a0/a1/d0/d1
  111.  
  112. no_self_modify:
  113.     lsr.w    #3,d6            ; width/8
  114.     move.w    bm_BytesPerRow(a1),a2
  115.     sub    d6,a2
  116.     move.l    bm_Planes(a1),a1    ; fetch first plane pointer
  117.     add.l    d1,a1            ; and add dest offset
  118.  
  119.     subq    #1,d6
  120.     move    d6,a3
  121.     move.l    #$f0f0f0f0,a4
  122.     move.l    #$cccccccc,a5
  123.     move.l    #$ff00ff00,a6
  124. yloop:
  125.     move    a3,d6
  126. EnPlane1:
  127. ; +--------------------------------------------------------+
  128. ; | Step (B1): Load registers with 8 pixels in chunky form |
  129. ; +--------------------------------------------------------+
  130.  
  131. EnPlane2:
  132.  
  133.     move.l    (a0)+,d0    ; a b c d
  134.     rol.w    #8,d0        ; a b d c
  135.     swap    d0
  136.     rol.w    #8,d0        ; d c b a
  137.     move.l    (a0)+,d1    ; a b c d
  138.     rol.w    #8,d1        ; a b d c
  139.     swap    d1
  140.     rol.w    #8,d1        ; d c b a
  141.  
  142. ; +----------------------------------------------------+
  143. ; | Step (B2): Rotate bits counterclockwise 90 degrees |
  144. ; +----------------------------------------------------+
  145. ;
  146. ; +-----------------------------------------------+
  147. ; | Step (B2a): Rotate 4x4 groups within full 8x8 |
  148. ; +-----------------------------------------------+
  149. ;
  150. ; Registers D0 and D1 are arranged like this:
  151. ;
  152. ;        +-------------+-------------+
  153. ; D0[ 7 -  0] = | a7 a6 a5 a4 | a3 a2 a1 a0 |
  154. ; D0[15 -  8] = | b7 b6 b5 b4 | b3 b2 b1 b0 |
  155. ; D0[23 - 16] = | c7 c6 c5 c4 | c3 c2 c1 c0 |
  156. ; D0[31 - 24] = | d7 d6 d5 d4 | d3 d2 d1 d0 |
  157. ;        +-------------+-------------+
  158. ; D1[ 7 -  0] = | e7 e6 e5 e4 | e3 e2 e1 e0 |
  159. ; D1[15 -  8] = | f7 f6 f5 f4 | f3 f2 f1 f0 |
  160. ; D1[23 - 16] = | g7 g6 g5 g4 | g3 g2 g1 g0 |
  161. ; D1[31 - 24] = | h7 h6 h5 h4 | h3 h2 h1 h0 |
  162. ;        +-------------+-------------+
  163. ;
  164. ;     +----+----+      +----+----+
  165. ;     | TL | TR |      | TR | BR |
  166. ; Rotate +----+----+ into +----+----+
  167. ;     | BL | BR |      | TL | BL |
  168. ;     +----+----+      +----+----+
  169. ;
  170. ; where each ?? (TL, TR, BL, or BR) is a 4-bit by 4-bit submatrix.
  171.  
  172.  
  173. ; D0 = d7d6d5d4d3d2d1d0 c7c6c5c4c3c2c1c0 b7b6b5b4b3b2b1b0 a7a6a5a4a3a2a1a0
  174. ; D1 = h7h6h5h4h3h2h1h0 g7g6g5g4g3g2g1g0 f7f6f5f4f3f2f1f0 e7e6e5e4e3e2e1e0
  175.  
  176.     Move.L    a4,D4    ; d4=$f0f0f0f0
  177.     Move.L    D4,D5
  178.     Not.L    D5
  179.  
  180.     Move.L    D0,D2
  181.     And.L    D4,D2
  182.  
  183. ; D2 = d7d6d5d4-------- c7c6c5c4-------- b7b6b5b4-------- a7a6a5a4--------
  184.  
  185.     Move.L    D1,D3
  186.     And.L    D5,D3
  187.  
  188. ; D3 = --------h3h2h1h0 --------g3g2g1g0 --------f3f2f1f0 --------e3e2e1e0
  189.  
  190.     LSL.L    #4,D0
  191.     And.L    D4,D0
  192.  
  193. ; D0 = d3d2d1d0-------- c3c2c1c0-------- b3b2b1b0-------- a3a2a1a0--------
  194.  
  195.     Or.L    D3,D0
  196.  
  197. ; D0 = d3d2d1d0h3h2h1h0 c3c2c1c0g3g2g1g0 b3b2b1b0f3f2f1f0 a3a2a1a0e3e2e1e0
  198.  
  199.     LSR.L    #4,D1
  200.     And.L    D5,D1
  201.  
  202. ; D1 = --------h7h6h5h4 --------g7g6g5g4 --------f7f6f5f4 --------e7e6e5e4
  203.  
  204.     Or.L    D2,D1
  205.  
  206. ; D1 = d7d6d5d4h7h6h5h4 c7c6c5c4g7g6g5g4 b7b6b5b4f7f6f5f4 a7a6a5a4e7e6e5e4
  207.  
  208.  
  209. ; +----------------------------------------------------------------+
  210. ; | Step (B2b): Prepare to rotate 2x2 groups within each 4x4 group |
  211. ; +----------------------------------------------------------------+
  212. ;
  213. ; Registers D0 and D1 are arranged like this:
  214. ;
  215. ;        +-------------+-------------+
  216. ; D0[ 7 -  0] = | a3 a2 a1 a0 | e3 e2 e1 e0 |
  217. ; D0[15 -  8] = | b3 b2 b1 b0 | f3 f2 f1 f0 |
  218. ; D0[23 - 16] = | c3 c2 c1 c0 | g3 g2 g1 g0 |
  219. ; D0[31 - 24] = | d3 d2 d1 d0 | h3 h2 h1 h0 |
  220. ;        +-------------+-------------+
  221. ; D1[ 7 -  0] = | a7 a6 a5 a4 | e7 e6 e5 e4 |
  222. ; D1[15 -  8] = | b7 b6 b5 b4 | f7 f6 f5 f4 |
  223. ; D1[23 - 16] = | c7 c6 c5 c4 | g7 g6 g5 g4 |
  224. ; D1[31 - 24] = | d7 d6 d5 d4 | h7 h6 h5 h4 |
  225. ;        +-------------+-------------+
  226. ;
  227. ; Exchange D0[31-16] with D1[15-0]
  228.  
  229.  
  230. ; D0 = d3d2d1d0h3h2h1h0 c3c2c1c0g3g2g1g0 b3b2b1b0f3f2f1f0 a3a2a1a0e3e2e1e0
  231. ; D1 = d7d6d5d4h7h6h5h4 c7c6c5c4g7g6g5g4 b7b6b5b4f7f6f5f4 a7a6a5a4e7e6e5e4
  232.  
  233.     Swap    D0
  234.  
  235. ; D0 = b3b2b1b0f3f2f1f0 a3a2a1a0e3e2e1e0 d3d2d1d0h3h2h1h0 c3c2c1c0g3g2g1g0
  236.  
  237.     Move.W    D0,D2
  238.     Move.W    D1,D0
  239.     Move.W    D2,D1
  240.  
  241. ; D0 = b3b2b1b0f3f2f1f0 a3a2a1a0e3e2e1e0 b7b6b5b4f7f6f5f4 a7a6a5a4e7e6e5e4
  242. ; D1 = d7d6d5d4h7h6h5h4 c7c6c5c4g7g6g5g4 d3d2d1d0h3h2h1h0 c3c2c1c0g3g2g1g0
  243.  
  244.     Swap    D0
  245.  
  246. ; D0 = b7b6b5b4f7f6f5f4 a7a6a5a4e7e6e5e4 b3b2b1b0f3f2f1f0 a3a2a1a0e3e2e1e0
  247.  
  248.  
  249. ; +-----------------------------------------------------+
  250. ; | Step (B2c): Rotate 2x2 groups within each 4x4 group |
  251. ; +-----------------------------------------------------+
  252. ;
  253. ; Registers D0 and D1 are arranged like this:
  254. ;
  255. ;        +-------------+-------------+
  256. ; D0[ 7 -  0] = | a3 a2 a1 a0 | e3 e2 e1 e0 |
  257. ; D0[15 -  8] = | b3 b2 b1 b0 | f3 f2 f1 f0 |
  258. ; D1[ 7 -  0] = | c3 c2 c1 c0 | g3 g2 g1 g0 |
  259. ; D1[15 -  8] = | d3 d2 d1 d0 | h3 h2 h1 h0 |
  260. ;        +-------------+-------------+
  261. ; D0[23 - 16] = | a7 a6 a5 a4 | e7 e6 e5 e4 |
  262. ; D0[31 - 24] = | b7 b6 b5 b4 | f7 f6 f5 f4 |
  263. ; D1[23 - 16] = | c7 c6 c5 c4 | g7 g6 g5 g4 |
  264. ; D1[31 - 24] = | d7 d6 d5 d4 | h7 h6 h5 h4 |
  265. ;        +-------------+-------------+
  266. ;
  267. ;     +------+------+      +------+------+
  268. ;     | ??tl | ??tr |      | ??tr | ??br |
  269. ; Rotate +------+------+ into +------+------+
  270. ;     | ??bl | ??br |      | ??tl | ??bl |
  271. ;     +------+------+      +------+------+
  272. ;
  273. ; Each ???? (??tl, ??tr, ??bl, or ??br) is a 2-bit by 2-bit
  274. ; submatrix that is part of the 4-bit by 4-bit submatrix ??
  275. ; (TL, TR, BL, or BR):
  276. ;
  277. ; +----+----+
  278. ; | TL | TR |
  279. ; +----+----+
  280. ; | BL | BR |
  281. ; +----+----+
  282.  
  283.  
  284. ; D0 = b7b6b5b4f7f6f5f4 a7a6a5a4e7e6e5e4 b3b2b1b0f3f2f1f0 a3a2a1a0e3e2e1e0
  285. ; D1 = d7d6d5d4h7h6h5h4 c7c6c5c4g7g6g5g4 d3d2d1d0h3h2h1h0 c3c2c1c0g3g2g1g0
  286.  
  287.     Move.L    a5,d4    ; d4=$CCCCCCCC
  288.     Move.L    D4,D5
  289.     Not.L    D5
  290.  
  291.     Move.L    D0,D2
  292.     And.L    D4,D2
  293.  
  294. ; D2 = b7b6----f7f6---- a7a6----e7e6---- b3b2----f3f2---- a3a2----e3e2----
  295.  
  296.     Move.L    D1,D3
  297.     And.L    D5,D3
  298.  
  299. ; D3 = ----d5d4----h5h4 ----c5c4----g5g4 ----d1d0----h1h0 ----c1c0----g1g0
  300.  
  301.     LSL.L    #2,D0
  302.     And.L    D4,D0
  303.  
  304. ; D0 = b5b4----f5f4---- a5a4----e5e4---- b1b0----f1f0---- a1a0----e1e0----
  305.  
  306.     Or.L    D3,D0
  307.  
  308. ; D0 = b5b4d5d4f5f4h5h4 a5a4c5c4e5e4g5g4 b1b0d1d0f1f0h1h0 a1a0c1c0e1e0g1g0
  309.  
  310.     LSR.L    #2,D1
  311.     And.L    D5,D1
  312.  
  313. ; D1 = ----d7d6----h7h6 ----c7c6----g7g6 ----d3d2----h3h2 ----c3c2----g3g2
  314.  
  315.     Or.L    D2,D1
  316.  
  317. ; D1 = b7b6d7d6f7f6h7h6 a7a6c7c6e7e6g7g6 b3b2d3d2f3f2h3h2 a3a2c3c2e3e2g3g2
  318.  
  319.  
  320. ; +-----------------------------------------------------------------+
  321. ; | Step (B2d): Prepare to rotate single bits within each 2x2 group |
  322. ; +-----------------------------------------------------------------+
  323. ;
  324. ; Registers D0 and D1 are arranged like this:
  325. ;
  326. ;        +-------------+-------------+
  327. ; D0[ 7 -  0] = | a1 a0 c1 c0 | e1 e0 g1 g0 |
  328. ; D0[15 -  8] = | b1 b0 d1 d0 | f1 f0 h1 h0 |
  329. ; D1[ 7 -  0] = | a3 a2 c3 c2 | e3 e2 g3 g2 |
  330. ; D1[15 -  8] = | b3 b2 d3 d2 | f3 f2 h3 h2 |
  331. ;        +-------------+-------------+
  332. ; D0[23 - 16] = | a5 a4 c5 c4 | e5 e4 g5 g4 |
  333. ; D0[31 - 24] = | b5 b4 d5 d4 | f5 f4 h5 h4 |
  334. ; D1[23 - 16] = | a7 a6 c7 c6 | e7 e6 g7 g6 |
  335. ; D1[31 - 24] = | b7 b6 d7 d6 | f7 f6 h7 h6 |
  336. ;        +-------------+-------------+
  337. ;
  338. ; Exchange D0[15-8] with D1[7-0], and exchange D0[31-24] with D1[23-16]
  339.  
  340.  
  341. ; D0 = b5b4d5d4f5f4h5h4 a5a4c5c4e5e4g5g4 b1b0d1d0f1f0h1h0 a1a0c1c0e1e0g1g0
  342. ; D1 = b7b6d7d6f7f6h7h6 a7a6c7c6e7e6g7g6 b3b2d3d2f3f2h3h2 a3a2c3c2e3e2g3g2
  343.  
  344.     Move.L    a6,d4    ;d4=FF00FF00
  345.     Move.L    D4,D5
  346.     Not.L    D5
  347.  
  348.     Move.L    D0,D2
  349.     And.L    D4,D2
  350.  
  351. ; D2 = b5b4d5d4f5f4h5h4 ---------------- b1b0d1d0f1f0h1h0 ----------------
  352.  
  353.     LSR.L    #8,D2
  354.  
  355. ; D2 = ---------------- b5b4d5d4f5f4h5h4 ---------------- b1b0d1d0f1f0h1h0
  356.  
  357.     Move.L    D1,D3
  358.     And.L    D5,D3
  359.  
  360. ; D3 = ---------------- a7a6c7c6e7e6g7g6 ---------------- a3a2c3c2e3e2g3g2
  361.  
  362.     LSL.L    #8,D3
  363.  
  364. ; D3 = a7a6c7c6e7e6g7g6 ---------------- a3a2c3c2e3e2g3g2 ----------------
  365.  
  366.     And.L    D5,D0
  367.  
  368. ; D0 = ---------------- a5a4c5c4e5e4g5g4 ---------------- a1a0c1c0e1e0g1g0
  369.  
  370.     Or.L    D3,D0
  371.  
  372. ; D0 = a7a6c7c6e7e6g7g6 a5a4c5c4e5e4g5g4 a3a2c3c2e3e2g3g2 a1a0c1c0e1e0g1g0
  373.  
  374.     And.L    D4,D1
  375.  
  376. ; D1 = b7b6d7d6f7f6h7h6 ---------------- b3b2d3d2f3f2h3h2 ----------------
  377.  
  378.     Or.L    D2,D1
  379.  
  380. ; D1 = b7b6d7d6f7f6h7h6 b5b4d5d4f5f4h5h4 b3b2d3d2f3f2h3h2 b1b0d1d0f1f0h1h0
  381.  
  382.  
  383. ; +------------------------------------------------------+
  384. ; | Step (B2e): Rotate single bits within each 2x2 group |
  385. ; +------------------------------------------------------+
  386. ;
  387. ; Registers D0 and D1 are arranged like this:
  388. ;
  389. ;        +-------------+-------------+
  390. ; D0[ 7 -  0] = | a1 a0 c1 c0 | e1 e0 g1 g0 |
  391. ; D1[ 7 -  0] = | b1 b0 d1 d0 | f1 f0 h1 h0 |
  392. ; D0[15 -  8] = | a3 a2 c3 c2 | e3 e2 g3 g2 |
  393. ; D1[15 -  8] = | b3 b2 d3 d2 | f3 f2 h3 h2 |
  394. ;        +-------------+-------------+
  395. ; D0[23 - 16] = | a5 a4 c5 c4 | e5 e4 g5 g4 |
  396. ; D1[23 - 16] = | b5 b4 d5 d4 | f5 f4 h5 h4 |
  397. ; D0[31 - 24] = | a7 a6 c7 c6 | e7 e6 g7 g6 |
  398. ; D1[31 - 24] = | b7 b6 d7 d6 | f7 f6 h7 h6 |
  399. ;        +-------------+-------------+
  400. ;
  401. ;     +--------+--------+      +--------+--------+
  402. ;     | ????TL | ????TR |      | ????TR | ????BR |
  403. ; Rotate +--------+--------+ into +--------+--------+
  404. ;     | ????BL | ????BR |      | ????TL | ????BL |
  405. ;     +--------+--------+      +--------+--------+
  406. ;
  407. ; Each ?????? (?????TL, ????TR, ????BL, or ????BR) is a single bit
  408. ; that is part of the 2-bit by 2-bit submatrix ???? (??tl, ??tr, ??bl,
  409. ; or ??br):
  410. ;
  411. ; +------+------+
  412. ; | ??tl | ??tr |
  413. ; +------+------+
  414. ; | ??bl | ??br |
  415. ; +------+------+
  416. ;
  417. ; Each ???? (??tl, ??tr, ??bl, or ??br) is a 2-bit by 2-bit submatrix
  418. ; that is part of the 4-bit by 4-bit submatrix ?? (TL, TR, BL, or BR):
  419. ;
  420. ; +----+----+
  421. ; | TL | TR |
  422. ; +----+----+
  423. ; | BL | BR |
  424. ; +----+----+
  425.  
  426.  
  427. ; D0 = a7a6c7c6e7e6g7g6 a5a4c5c4e5e4g5g4 a3a2c3c2e3e2g3g2 a1a0c1c0e1e0g1g0
  428. ; D1 = b7b6d7d6f7f6h7h6 b5b4d5d4f5f4h5h4 b3b2d3d2f3f2h3h2 b1b0d1d0f1f0h1h0
  429.  
  430.     Move.L    #$AAAAAAAA,D4
  431.     Move.L    D4,D5
  432.     Not.L    D5
  433.  
  434.     Move.L    D0,D2
  435.     And.L    D4,D2
  436.  
  437. ; D2 = a7--c7--e7--g7-- a5--c5--e5--g5-- a3--c3--e3--g3-- a1--c1--e1--g1--
  438.  
  439.     Move.L    D1,D3
  440.     And.L    D5,D3
  441.  
  442. ; D3 = --b6--d6--f6--h6 --b4--d4--f4--h4 --b2--d2--f2--h2 --b0--d0--f0--h0
  443.  
  444.     add.l    d0,d0
  445.     And.L    D4,D0
  446.  
  447. ; D0 = a6--c6--e6--g6-- a4--c4--e4--g4-- a2--c2--e2--g2-- a0--c0--e0--g0--
  448.  
  449.     Or.L    D3,D0
  450.  
  451. ; D0 = a6b6c6d6e6f6g6h6 a4b4c4d4e4f4g4h4 a2b2c2d2e2f2g2h2 a0b0c0d0e0f0g0h0
  452.  
  453.  
  454.  
  455. ; +-------------------------------------------+
  456. ; | Step (B3):  Store 8 pixels in planar form |
  457. ; +-------------------------------------------+
  458. ;
  459. ; Registers D0 and D1 are arranged like this:
  460. ;
  461. ;        +-------------+-------------+
  462. ; D0[ 7 -  0] = | a0 b0 c0 d0 | e0 f0 g0 h0 |
  463. ; D1[ 7 -  0] = | a1 b1 c1 d1 | e1 f1 g1 h1 |
  464. ; D0[15 -  8] = | a2 b2 c2 d2 | e2 f2 g2 h2 |
  465. ; D1[15 -  8] = | a3 b3 c3 d3 | e3 f3 g3 h3 |
  466. ;        +-------------+-------------+
  467. ; D0[23 - 16] = | a4 b4 c4 d4 | e4 f4 g4 h4 |
  468. ; D1[23 - 16] = | a5 b5 c5 d5 | e5 f5 g5 h5 |
  469. ; D0[31 - 24] = | a6 b6 c6 d6 | e6 f6 g6 h6 |
  470. ; D1[31 - 24] = | a7 b7 c7 d7 | e7 f7 g7 h7 |
  471. ;        +-------------+-------------+
  472.  
  473.  
  474. ; D0 = a6b6c6d6e6f6g6h6 a4b4c4d4e4f4g4h4 a2b2c2d2e2f2g2h2 a0b0c0d0e0f0g0h0
  475.  
  476.     move.b    d0,(a1)+
  477.     Swap    D0
  478.     LSR.L    #1,D1
  479.     And.L    D5,D1
  480.  
  481. ; D1 = --b7--d7--f7--h7 --b5--d5--f5--h5 --b3--d3--f3--h3 --b1--d1--f1--h1
  482.  
  483.  
  484. ; D0 = a2b2c2d2e2f2g2h2 a0b0c0d0e0f0g0h0 a6b6c6d6e6f6g6h6 a4b4c4d4e4f4g4h4
  485.  
  486. modify_me_plane4:
  487.     move.b    d0,$1234(a1)
  488.     RoR.L    #8,D0
  489.  
  490. ; D0 = a4b4c4d4e4f4g4h4 a2b2c2d2e2f2g2h2 a0b0c0d0e0f0g0h0 a6b6c6d6e6f6g6h6
  491.  
  492. modify_me_plane6:
  493.     move.b    d0,$1234(a1)
  494.     Or.L    D2,D1
  495.  
  496. ; D1 = a7b7c7d7e7f7g7h7 a5b5c5d5e5f5g5h5 a3b3c3d3e3f3g3h3 a1b1c1d1e1f1g1h1
  497.     Swap    D0
  498.  
  499. ; D0 = a0b0c0d0e0f0g0h0 a6b6c6d6e6f6g6h6 a4b4c4d4e4f4g4h4 a2b2c2d2e2f2g2h2
  500.  
  501. modify_me_plane2:
  502.     move.b    d0,$1234(a1)
  503. modify_me_plane1:
  504.     Move.B    D1,$1234(a1)
  505.     Swap    D1
  506.  
  507. ; D1 = a3b3c3d3e3f3g3h3 a1b1c1d1e1f1g1h1 a7b7c7d7e7f7g7h7 a5b5c5d5e5f5g5h5
  508.  
  509. modify_me_plane5:
  510.     move.b    d1,$1234(a1)
  511.     RoR.L    #8,D1
  512.  
  513. ; D1 = a5b5c5d5e5f5g5h5 a3b3c3d3e3f3g3h3 a1b1c1d1e1f1g1h1 a7b7c7d7e7f7g7h7
  514.  
  515. modify_me_plane7:
  516.     move.b    d1,$1234(a1)
  517.     Swap    D1
  518.  
  519. ; D1 = a1b1c1d1e1f1g1h1 a7b7c7d7e7f7g7h7 a5b5c5d5e5f5g5h5 a3b3c3d3e3f3g3h3
  520.  
  521. modify_me_plane3:
  522.     Move.B    D1,$1234(a1)
  523.  
  524. ; +-------------------------------+
  525. ; | Step (C): Continue processing |
  526. ; +-------------------------------+
  527.  
  528.     dbra    d6,EnPlane1
  529.     ifeq    DOBLUR
  530.     lea    8(a0),a0
  531.     endc
  532.     add.l    a2,a1
  533.     dbra    d7,yloop
  534.     MoveM.L (A7)+,D2-D7/A2-a6          ;Restore registers
  535.     Rts                ;Return
  536.  
  537.     End
  538.  
  539.  
  540.